package z_exam;

import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;

/**
 * @Author: 海琳琦
 * @Date: 2022/3/19 15:04
 */
public class Main {

    /**
     * 小七：a 坦克数量
     * 对手：炸毁 k * c 坦克  碉堡血量: b
     * @param args
     */
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while(sc.hasNext()){
            //a：坦克数量
            int a = sc.nextInt();
            //b：碉堡血量
            int b = sc.nextInt();
            //c：炸毁坦克数量
            int c = sc.nextInt();
            //d：堡垒数量
            int d = sc.nextInt();
            System.out.println(simulation(a, b, c, d));
        }
    }


    public int shortestPathLength(int[][] graph) {
        int n = graph.length;
        Queue<int[]> queue = new LinkedList<int[]>();
        boolean[][] seen = new boolean[n][1 << n];
        for (int i = 0; i < n; ++i) {
            queue.offer(new int[]{i, 1 << i, 0});
            seen[i][1 << i] = true;
        }

        int ans = 0;
        while (!queue.isEmpty()) {
            int[] tuple = queue.poll();
            int u = tuple[0], mask = tuple[1], dist = tuple[2];
            if (mask == (1 << n) - 1) {
                ans = dist;
                break;
            }
            // 搜索相邻的节点
            for (int v : graph[u]) {
                // 将 mask 的第 v 位置为 1
                int maskV = mask | (1 << v);
                if (!seen[v][maskV]) {
                    queue.offer(new int[]{v, maskV, dist + 1});
                    seen[v][maskV] = true;
                }
            }
        }
        return ans;
    }



    /**
     * 模拟 返回回合数，否则返回-1
     * @param a 坦克数量
     * @param b 碉堡血量
     * @param c 炸毁坦克数量
     * @param d 堡垒数量
     * @return
     */
    public static int simulation(int a, int b, int c, int d){
        //轮数
        int count = 0;
        //剩余的堡垒数量
        int k = d;
        //堡垒总共的血量
        int totalBlood = b * d;
        while(true){
            count++;
            //小七先攻击
            totalBlood -= a;
            if (totalBlood <= 0) {
                return count;
            }
            //剩余坦克数
            k = totalBlood % b == 0 ? totalBlood / b: totalBlood / b + 1;
            //碉堡攻击
            a -= k * c;
            if (a <= 0) {
                return -1;
            }
        }
    }
}
